package org.jackysoft.entity;

import java.io.Serializable;
import java.util.Collection;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.apache.struts2.json.annotations.JSON;
import org.hibernate.annotations.GenericGenerator;

import com.google.common.collect.Lists;

@Entity
@org.hibernate.annotations.Entity(dynamicUpdate = true, dynamicInsert = true)
public class LoginPage extends AbstractNoIdEntity implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2725032390976201124L;
	private String targetUrl;
	private Collection<AcegiRole> secuRoles = Lists.newArrayList();
	
	
	
	@Id
	@GeneratedValue(generator = "agn")
	@GenericGenerator(name = "agn", strategy = "assigned")
	public String getTargetUrl() {
		return targetUrl;
	}

	public void setSecuRoles(Collection<AcegiRole> secuRoles) {
		this.secuRoles = secuRoles;
	}

	@OneToMany(mappedBy="login")
	@JSON(serialize=false)
	public Collection<AcegiRole> getSecuRoles() {
		return secuRoles;
	}

	public void setTargetUrl(String targetUrl) {
		this.targetUrl = targetUrl;
	}	

}